package employee;

import java.util.ArrayList;
import java.util.List;

import lecture.Lecture;
import lecture.LectureEntity;
import model.Entity;

public class Employee extends Entity{

	protected String firstName = null;
	protected String email = null;
	protected List<Lecture> lecturesResponsability;
	protected List<LectureEntity> lectureEntitiesResponsability;
	
	public Employee(){
		this.firstName = "Default";
		this.email = "?";
		this.lectureEntitiesResponsability = new ArrayList<LectureEntity>();
		this.lecturesResponsability = new ArrayList<Lecture>();
	}

	public Employee(String name, String firstName, String email)
	{
		super(name);
		this.firstName = firstName;
		this.email = email;
		this.lectureEntitiesResponsability = new ArrayList<LectureEntity>();
		this.lecturesResponsability = new ArrayList<Lecture>();
	}
	
	public Employee(String name, String firstName)
	{
		this(name, firstName, "?");
	}
	
	public void addLecture(Lecture l)
	{
		this.lecturesResponsability.add(l);
	}
	
	public boolean removeLecture(Lecture l)
	{
		return this.lecturesResponsability.remove(l) ;
	}
	
	public void addLectureEntity(LectureEntity l)
	{
		this.lectureEntitiesResponsability.add(l);
	}
	
	public boolean removeLectureEntity(LectureEntity l)
	{
		return this.lectureEntitiesResponsability.remove(l) ;
	}
	
	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public List<Lecture> getLecturesResponsability() {
		return lecturesResponsability;
	}

	public void setLecturesResponsability(List<Lecture> lecturesResponsability) {
		this.lecturesResponsability = lecturesResponsability;
	}

	public List<LectureEntity> getLectureEntitiesResponsability() {
		return lectureEntitiesResponsability;
	}

	public void setLectureEntitiesResponsability(
			List<LectureEntity> lectureEntitiesResponsability) {
		this.lectureEntitiesResponsability = lectureEntitiesResponsability;
	}

	public String toString()
	{
		StringBuilder tmp = new StringBuilder("Employee");
		tmp.append("\n"); tmp.append(this.firstName); tmp.append(" "); tmp.append(this.getName());
		tmp.append("\n"); tmp.append(this.email);
		tmp.append("\nlectures responsability: "); for(Lecture l: this.lecturesResponsability) {tmp.append(l.getName()); tmp.append(' ');};
		tmp.append("\n lectures entities responsability: "); for(LectureEntity l: this.lectureEntitiesResponsability) {tmp.append(l.getName()); tmp.append(' ');};
		return tmp.toString();
	}
}
